package com.fz.mapper;

import com.fz.model.Student;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.StatementType;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/1/10.
 */
public interface StudentMapper {
    public  List<Student> query();
    //执行sql语句
    public  int insert(@Param("s_name") String s1,@Param("s_address") String s2);
    @Select("select * from student")
    public List<Student> selectAll();
    @Insert("insert into student values(null,#{0},#{1})")
    public int ins(String name,String adress);
    @Update("update student set s_name=#{0},s_address=#{1} where s_id=#{2}")
    public int upda(String name,String address,int id);
    @Delete("delete from student where s_id=#{0}")
    public int delet(int id);
    //执行存储过程
    @Select("call myshows()") @Options(statementType = StatementType.CALLABLE)
    public List<Student> ss();
    @Insert(" call myinsert(#{s_name},#{s_address})") @Options(statementType = StatementType.CALLABLE)
    public int ii(@Param("s_name")String name,@Param("s_address")String address);
    @Update("call myupdate(#{s_name},#{s_address},#{s_id})") @Options(statementType = StatementType.CALLABLE)
    public int uu(@Param("s_name") String name,@Param("s_address")String address,@Param("s_id")int id);
    @Delete("call mydelete(#{s_id})") @Options(statementType = StatementType.CALLABLE)
    public int dd(@Param("s_id") int id);
    //分页

    //一对一
    public List<Map<String,Object>> syi(int id);

}
